/*
 *  The resize function reserves the original elements.
 *  After call the resize function, you call the push_back
 *  function, it will add element to the end and add the size.
 *  You can use resize to alloc memory and set the value of new memory.
 *
 * */

#include <iostream>

#include <vector>

using namespace std;

int main(int argc, const char *argv[])
{
    vector<int> v1;
    v1.push_back(1);
    for (auto &i : v1) {
        cout << i << endl;
    }
    cout << endl;
    //v1.resize(10);

    for (auto &i : v1) {
        cout << i << endl;
    }
    cout << endl;
    v1.resize(10,3);
    for (auto &i : v1) {
        cout << i << endl;
    }
    v1.push_back(2);
    cout << endl;

    for (auto &i : v1) {
        cout << i << endl;
    }
    cout << endl;
    v1.resize(5,5);
    for (auto &i : v1) {
        cout << i << endl;
    }
    cout << endl;
    return 0;
}
